package com.data.data_base.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.data.data_base.domain.Student;
import com.data.data_base.service.StudentService;
import lombok.AllArgsConstructor;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Classname: StudentController
 * @Description: 学生控制器
 * @Date: 2021/5/31
 * @Author: huwei
 */
@RestController
@RequestMapping("base/student")
@AllArgsConstructor
public class StudentController {

    private final StudentService studentService;

    @GetMapping("/linkTest")
    public String linkTest(){
        return "链接成功";
    }

    @GetMapping("/selectList/{pageNum}/{pageCount}")
    public IPage<Student> selectList(@PathVariable("pageNum")Integer pageNum, @PathVariable("pageCount")Integer pageCount){
        return studentService.selectList(pageNum,pageCount);
    }

    @PostMapping("/saveMaster")
    public Integer saveMaster(@RequestBody Student student){
        return studentService.saveMasterStudent(student);
    }

    @PostMapping("/saveSlave")
    public Integer saveSlave(@RequestBody Student student){
        return studentService.saveSalveStudent(student);
    }
}
